<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .fade-enter,/* 显示 */
        .fade-leave-to{/* 隐藏 */
            opacity: 0;/* 不透明度0表示隐藏状态 */
        }
        .fade-enter-active,/* 显示 */
        .fade-leave-active{/* 隐藏 */
            transition:opacity 1s;/* 检测到不透明度改变就做过渡动画 */
        }
    </style>
</head>
<body>
    <div id="app">
        <transition name="fade"><!-- transition包裹的内容会有动画过渡效果 -->
            <div v-if="show">hello world</div>
        </transition>
        <button @click="handleClick">切换</button>
    </div>
    <script>
        var vm=new Vue({
            el:'#app',
            data:{
                show:true
            },
            methods:{
                handleClick:function(){
                    this.show=!this.show;
                }
            }

        })
    </script>
</body>
</html>